<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:if test="${list.totalPages>1}">
<div class="col-md-6">
	<ul class="pagination">
		<li><a href="javascript:void();">总数：${list.totalElements}</a></li>
		<li <c:if test="${list.number==0}">class="disabled"</c:if>><a href="javascript:gotoPage(${list.number-1})">上一页</a></li>
		<c:forEach begin="1" end="${list.totalPages}" var="item">
		<c:if test="${item < 4 || item==list.number || item==list.number+1|| item==list.number+2 || item + 3 > list.totalPages }">
		<li <c:if test="${list.number+1==item }">class="active"</c:if>><a href="javascript:gotoPage(${item-1})">${item}</a></li></c:if>
		</c:forEach>
		<li <c:if test="${list.number+1==list.totalPages}">class="disabled"</c:if>><a href="javascript:gotoPage(${list.number+1})">下一页 </a></li>
	</ul>
</div>
</c:if>
<script type="text/javascript">
$(function(){
	$('body').append('<input id="extend_OrderBy" type="hidden" value="${sortName}" /><input id="extend_Order" type="hidden" value="${sortOrder}" />');
});

<!--
function gotoPage(pageNum){
	location.href = this.location.pathname + '?page=' + pageNum  + '&' + param($("#searchForm").serializeArray())
			+ "&sortName=" + $.trim($('#extend_OrderBy').val()) + "&sortOrder=" + $.trim($('#extend_Order').val());
}

function param(obj) {
    var params = '';
    $.each(obj, function (i, objVal) {
    	params += '&' + objVal.name + '=';
        params += encodeURIComponent(encodeURIComponent(objVal.value));
    });
    return  params.length > 0 ? params.toString().substring(1) : '';
}

function extend_sort(obj, field){
    // revert style
    $('#list-form th .extend_user').each(function () {
        $(this).attr('class', 'extend_user sort-view');
    });
    var sortName = $('#extend_OrderBy').val();
    var sortOrder = $('#extend_Order').val();
    if (sortName == field) {
        if (sortOrder == 'asc') {
        	$('#extend_Order').val('desc');
            $(obj).find('span').attr('class', 'extend_user sort-desc');
        } else {
        	$('#extend_Order').val('asc');
            $(obj).find('span').attr('class', 'extend_user sort-asc');
        }
    } else {
    	$('#extend_OrderBy').val(field);
        $('#extend_Order').val('desc');
        $(obj).find('span').attr('class', 'extend_user sort-desc');
    }
    gotoPage('${list.number}');
}

/**
 * 合计.
 */
function page_agg(tableObj, indexArray){
	var colsNum = tableObj.find('tr').last().find('td').length;
	var cntObj = new Object(indexArray.length);
	for(var i=0; i<indexArray.length; i++){
		cntObj[''+ indexArray[i]  +''] = 0;
	}
	tableObj.find('tr:not(first)').each(function(){
		$(this).find('td').each(function(i){
			if($.inArray(i, indexArray)>-1){
				cntObj[''+ i  +''] += parseFloat($(this).text());
			}
		});
	});
	var tr_html = '<tr style="font-weight:900;">';
	tr_html += '<td style="text-align:center; padding-left: 1px; padding-right: 1px;">合计</td>';
	for(var i=1; i<colsNum; i++){
		var v_html = '';
		if($.inArray(i, indexArray)>-1){
			v_html = cntObj[''+ i  +''].toString();
			
			if(v_html.indexOf(".")>-1){
				v_html = v_html.substring(0, v_html.indexOf(".") + 3);
			}
			v_html = v_html == '' ? '0' : v_html;
		}
		tr_html += '<td style="text-align:right;">' + v_html + '</td>';
	}
	tr_html += '</tr>';
	tableObj.append(tr_html);
}
//-->
</script>